package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 退款类型(1-用户申请退款，2-核销过期自动退,3-报名活动未满员自动退，4-阶梯价格退还，5-票付通出票失败退款)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum RefundTypeEnum {

    USER_REFUND(1, "用户申请退款"),
    VERIFY_EXPIRE(2, "核销过期自动退"),
    NO_FULL(3, "报名活动未满员自动退"),
    STEP_PRICE(4, "阶梯价格退还"),
    PFT_REFUND(5, "票付通出票失败退款"),
    GROUP_FREE(6, "拼团免单"),
    GROUP_FAILED(7, "拼团失败");
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    RefundTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static RefundTypeEnum typeOf(Integer value) {
        RefundTypeEnum[] values = RefundTypeEnum.values();
        for (RefundTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static RefundTypeEnum typeOf(String name) {
        RefundTypeEnum[] values = RefundTypeEnum.values();
        for (RefundTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }


}
